
var APP_ID = 'NiLiWqWygKQT0cE2hLkKIaPH-gzGzoHsz';
var APP_KEY = 'MGcBs4clDykKkzDszairRiMD';

AV.init({
	appId: APP_ID,
	appKey: APP_KEY
});



//津京冀
var cql_jjj = 'select * from JJJ ';
AV.Query.doCloudQuery(cql_jjj).then(function(data) {
	// results 即为查询结果，它是一个 AV.Object 数组
	var results = data.results;
	var l = results.length - 1;
	
	$(".date").html(results[l]._serverData.writeDate)//获取填报日期
	
	console.log(results[l]._serverData.writeDate);
	var JJJ_SUM = results[l]._serverData.jjj_sum;
	var JJJ_NEW = results[l]._serverData.jjj_new;
	$("#jjj_sum").html(JJJ_SUM);
	$("#jjj_new").html(JJJ_NEW);
	
}, function(error) {});

//二维码
//
var cql_NewMachine = 'select * from NewMachine ';
AV.Query.doCloudQuery(cql_NewMachine).then(function(data) {
	// results 即为查询结果，它是一个 AV.Object 数组
	var results = data.results;
	var l = results.length - 1;
	var new_machine_sum = results[l]._serverData.new_machine_sum;
	var new_machine_add = results[l]._serverData.new_machine_add;
	$("#new_machine_sum").html(new_machine_sum);
	$("#new_machine_add").html(new_machine_add);
	
}, function(error) {});

//车载机上线

	var cql_Machine_online = 'select * from Machine_online ';
AV.Query.doCloudQuery(cql_Machine_online).then(function(data) {
	// results 即为查询结果，它是一个 AV.Object 数组
	var results = data.results;
	var l = results.length - 1;
	
	var month_sum = results[l]._serverData.month_sum;
	var month_percent = results[l]._serverData.month_percent;
	
	var week_sum = results[l]._serverData.week_sum;
	var week_percent = results[l]._serverData.week_percent;
	
	var day_sum = results[l]._serverData.day_sum;
	var day_percent = results[l]._serverData.day_percent;
	
	$("#week_sum").html(week_sum);
	$("#week_percent").html(week_percent);
	
	$("#month_sum").html(month_sum);
	$("#month_percent").html(month_percent);
	
	$("#day_sum").html(day_sum);
	$("#day_percent").html(day_percent);
	
}, function(error) {});


//当日车载机变化情况
var cql_machine_change = 'select * from Machine_change ';
AV.Query.doCloudQuery(cql_machine_change).then(function(data) {
	// results 即为查询结果，它是一个 AV.Object 数组
	var results = data.results;
	var l = results.length - 1;
//	console.log(results[l]._serverData.machine_change);
	var machine_change = results[l]._serverData.machine_change;
	$("#machine_change").html(machine_change);
	
}, function(error) {});

//备机
var cql_stand_by = 'select * from Stand_By ';
AV.Query.doCloudQuery(cql_stand_by).then(function(data) {
	// results 即为查询结果，它是一个 AV.Object 数组
	var results = data.results;
	var l = results.length - 1;
	var standby_1 = results[l]._serverData.standby_1;
	var standby_2 = results[l]._serverData.standby_2;
	var standby_3 = results[l]._serverData.standby_3;
	var standby_4 = results[l]._serverData.standby_4;
	var standby_5 = results[l]._serverData.standby_5;
	var standby_6 = results[l]._serverData.standby_6;
	var standby_7 = results[l]._serverData.standby_7;
	
	
	$("#standby_1").html(standby_1);
	$("#standby_2").html(standby_2);
	$("#standby_3").html(standby_3);
	$("#standby_4").html(standby_4);
	$("#standby_5").html(standby_5);
	$("#standby_6").html(standby_6);
	$("#standby_7").html(standby_7);
}, function(error) {});

//故障分析
var cql_trouble_analyze = 'select * from TroubleAnalyze ';
AV.Query.doCloudQuery(cql_trouble_analyze).then(function(data) {
	// results 即为查询结果，它是一个 AV.Object 数组
	var results = data.results;
	var l = results.length - 1;
	
	var OnStart = results[l]._serverData.OnStart;
	var OnShow = results[l]._serverData.OnShow;
	var OnCard = results[l]._serverData.OnCard;
	var QRcode = results[l]._serverData.QRcode;
	var NetWork = results[l]._serverData.NetWork;
	var other = results[l]._serverData.other;
	
	
	$("#OnStart").html(OnStart);
	$("#OnShow").html(OnShow);
	$("#OnCard").html(OnCard);
	$("#QRcode").html(QRcode);
	$("#NetWork").html(NetWork);
	$("#other").html(other);
}, function(error) {});